import request from '@/router/axios';

export const getList = (current, size, params) => {
  return request({
    url: '/api/emerPlan/plan/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/emerPlan/plan/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/emerPlan/plan/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/emerPlan/plan/save',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/emerPlan/plan/update',
    method: 'post',
    data: row
  })
}

export const getYalxList = () => {
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=emer_plan_yalx',
    method: 'get'
  })
}

export const getHazardSList = (current, size, params) => {
  return request({
    url: '/api/major/page',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getSybmList = () => {
  return request({
    url: '/api/emerPlan/plan/getSybmList',
    method: 'get'
  })
}

export const getYabhByCustom = () => {
  return request({
    url: '/api/emerPlan/plan/getYabhByCustom',
    method: 'get'
  })
}

export const planPublish = (id) => {
  return request({
    url: '/api/emerPlan/plan/planPublish',
    method: 'post',
    params: {
      id
    }
  })
}

export const invalidPlan = (ids) => {
  return request({
    url: '/api/emerPlan/plan/invalidPlan',
    method: 'post',
    params: {
      ids
    }
  })
}

export const getPlanStatus = () => {
  return request({
    url: '/api/blade-system/dict-biz/dictionary?code=emer_plan_status',
    method: 'get'
  })
}

export const approvalStatus = (id, spjg) => {
  return request({
    url: '/api/emerPlan/plan/approvalStatus',
    method: 'post',
    params: {
      id,
      spjg
    }
  })
}

export const modifyPlan = (row) => {
  return request({
    url: '/api/emerPlan/plan/modifyPlan',
    method: 'post',
    data: row
  })
}

// 修订记录列表
export const getModifyRecordList = (current, size, params) => {
  return request({
    url: '/api/emerPlan/plan/list',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}
